/*
 * @Descripttion: GGB
 * @version: 1.0
 * @Author: GGB
 * @Date: 2021-08-19 10:23:35
 * @LastEditors: GGB
 * @LastEditTime: 2021-08-19 11:11:58
 */
import 'package:flutter/material.dart';
import 'package:flutter_data_center/model/warning/warning_model.dart';
import 'package:flutter_data_center/utills/color_utils.dart';

class WarningItem extends StatelessWidget {
  const WarningItem({Key key, this.warning}) : super(key: key);
  final WarningModel warning;

  @override
  Widget build(BuildContext context) => Column(
        children: [
          SizedBox(height: 16),
          Container(
            height: 103,
            width: double.infinity,
            padding: EdgeInsets.all(10),
            decoration: BoxDecoration(
              borderRadius: BorderRadius.circular(10),
              color: Colors.white,
            ),
            child: Column(children: [
              Row(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: [
                  Text(
                    warning.address,
                    style: TextStyle(
                      color: gColor("#08D187"),
                      fontSize: 10,
                    ),
                  ),
                  Text(
                    warning.time,
                    style: TextStyle(
                      color: gColor("#C2C2C2"),
                      fontSize: 10,
                    ),
                  ),
                ],
              ),
              SizedBox(height: 7),
              Row(
                mainAxisSize: MainAxisSize.max,
                crossAxisAlignment: CrossAxisAlignment.start,
                children: [
                  Container(
                    width: 6,
                    height: 56,
                    decoration: BoxDecoration(
                      color: gColor("#FF0404"),
                      borderRadius: BorderRadius.circular(20),
                    ),
                  ),
                  Expanded(
                    child: Padding(
                      padding: const EdgeInsets.symmetric(horizontal: 10),
                      child: Column(
                        mainAxisSize: MainAxisSize.max,
                        crossAxisAlignment: CrossAxisAlignment.start,
                        mainAxisAlignment: MainAxisAlignment.start,
                        children: [
                          Text(
                            warning.level,
                            style: TextStyle(
                              fontSize: 15,
                            ),
                          ),
                          Text(
                            warning.description,
                            maxLines: 2,
                            overflow: TextOverflow.ellipsis,
                            style: TextStyle(
                              fontSize: 13,
                              color: gColor("#B1B1B1"),
                            ),
                          ),
                        ],
                      ),
                    ),
                  ),
                  Container(
                    width: 48,
                    height: 18,
                    margin: const EdgeInsets.only(top: 30),
                    alignment: Alignment.center,
                    decoration: BoxDecoration(
                      color: gColor("#EAEAEA"),
                      borderRadius: BorderRadius.circular(15),
                    ),
                    child: Text(
                      "${warning.status ? "已处理" : "未处理"}",
                      style: TextStyle(
                        height: 1,
                        fontSize: 10,
                        color: gColor("#838383"),
                      ),
                    ),
                  ),
                ],
              ),
            ]),
          ),
        ],
      );
}
